﻿#ifndef INJECTORSETTINGWIDGET_H
#define INJECTORSETTINGWIDGET_H

#include <QWidget>
#include <QtWidgets>
#include "../../include/injectordata.h"

class InjectorSettingWidget : public QWidget
{
    Q_OBJECT
public:
    InjectorSettingWidget();
    ~InjectorSettingWidget();

    void setInfo(const InjectorData& data);
    void showWarning(const QString& text);

    bool checkSetting();
    InjectorSetting getSetting();
    QPushButton *okButton;
    QLineEdit* pos_ed,*name_ed;
    QLineEdit* inj_period_ed, *comm_period_ed;
    QLineEdit* inj_vol_ed,*max_cur_ed,*min_vol_ed;
    QLabel* sta_ll, *bat_ll, *oil_ll;

private:
    QWidget* setup_warnbox();
    QLayout* setup_settingWindow();
    InjectorData data;

    QPushButton* settingButton, *cancelButton;
    QTextEdit* warntext;

    void showSetting();
    void confirmSetting();
    void cancelSetting();
    void flush();
};

#endif // INJECTORSETTINGWIDGET_H
